package com.hehe.ai.langchain4j.config;

import com.hehe.ai.langchain4j.store.MongoChatMemoryStore;
import dev.langchain4j.memory.chat.ChatMemoryProvider;
import dev.langchain4j.memory.chat.MessageWindowChatMemory;
import dev.langchain4j.store.memory.chat.InMemoryChatMemoryStore;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author: hehe
 * @create: 2025-05-13 14:12
 * @Description:
 */
@Configuration
@RequiredArgsConstructor
public class SeparateChatAssistantConfig {

    private final MongoChatMemoryStore store;
    @Bean
    public ChatMemoryProvider chatMemoryProvider() {
        return memoryId->MessageWindowChatMemory
                .builder()
                .id(memoryId)
                .maxMessages(10)
                .chatMemoryStore(store)
                .build();
    }
}
